<?php

namespace common\components;

use Yii;
use common\base\NotLoggedInHttpException;
use yii\base\Exception;

/**
 * User is the class for the `user` application component that manages the user authentication status.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class User extends \yii\web\User {

    /**
     * Redirects the user browser to the login page.
     */
    public function loginRequired($checkAjax = true, $checkAcceptHeader = true) {
        try {
            return parent::loginRequired($checkAjax, $checkAcceptHeader);
        } catch (Exception $e) {
            throw new NotLoggedInHttpException($e->getMessage());
        }
    }

    public function getIsCard() {
        return false;
    }

    public function getIsAuthent() {
        return false;
    }

}
